<%@page import="java.util.UUID"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/pages/common/taglib.jsp" %>
<%
    String uuid = UUID.randomUUID().toString();
    request.setAttribute("uuid", uuid);
%>
<form  id="wordNumberForm" class="container-fluid am-margin-top">
	<input type="hidden" name="id"/>
	
	<div class="form-group col-sm-6">
         <label for="title">名称</label>
         <input type="text" name="title" class="form-control" check-type="required">
     </div>
     <div class="form-group col-sm-6">
         <label for="code">编码</label>
         <input type="text" name="code" class="form-control" check-type="required">
     </div>
	<div class="form-group pull-right">
         <a href="javascript:void(0)" id="wordNumberSubmitBt"  class="btn btn-primary">保存</a>
     </div>
</form>
<script type="text/javascript">
$(function(){
	var uuid = '${uuid}';
    var id = '${param.id}';
    var wordNumberForm=$("#wordNumberForm");
    wordNumberForm.validation();
    if(id){
    	$.getJSON(ctx + '/wordNumberAct/findWordNumberById.do', {id: id}, function (data) {
            webUtils.fullForm({
                form: $("#wordNumberForm"),
                data: data
            });
        });
    }
    
	$("#wordNumberSubmitBt").click(function(){
		if(wordNumberForm.valid()){
			wordNumberForm.ajaxSubmit({
	            url: ctx + '/wordNumberAct/saveWordNumber.do',
	            data: {},
	            type: "POST",
	            success: function (data) {
	                if (data.success) {
	                    webUtils.alert("提交成功");
	                    top.webUtils.topicPublish("wordNumber.edit.success", data);
	                } else {
	                	webUtils.error(data.msg);
	                }
	            }
	        });
		}
	});
})
</script>